package com.wyz.saas.module.patrol.bean.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.wyz.saas.module.patrol.bean.PatrolCheckpoint
import kotlinx.coroutines.flow.Flow

@Dao
interface PatrolCheckpointDao {
    @Query("SELECT * FROM table_patrol_checkpoint ORDER BY label ASC")
    fun getAlphabetizedWords(): List<PatrolCheckpoint>

    @Query("SELECT * FROM table_patrol_checkpoint ORDER BY label ASC")
    fun getAlphabetizedWordsByFlow(): Flow<List<PatrolCheckpoint>>

    @Insert(onConflict = OnConflictStrategy.IGNORE)
    fun insert(value: PatrolCheckpoint)

    @Query("DELETE FROM table_patrol_checkpoint")
    fun deleteAll(): Int
}